home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / vedt.zip / DEMO12A.TXT < prev    next >
Text File  |  1989-05-24  |  1KB  |  51 lines

  1. /*  --  A Typical "C" subroutine        */
  2.  
  3. /* EXPAND - Expand and display control sequence */
  4.  
  5. expand(kbuf)
  6. unsigned char *kbuf;        /* KBUF ends in KFF !! */
  7. {
  8. register unsigned char *sptr, *kptr, c;
  9. unsigned char messbuf[MAXSTR], save[MAXSTR];
  10.  
  11. int getmess();
  12.  
  13.     kptr = kbuf;
  14.     sptr = save;        /* Init PTR to buffer ending in 00 */
  15.  
  16.     /* Convert "^Z" to CTRL-Z and change to use 00 terminator */
  17.  
  18.     while (*kptr != KFF) {
  19.     *sptr = *kptr++;
  20.     if (*sptr == '^') {
  21.         if (*kptr != '^') *sptr = *kptr & 0x1F;
  22.         kptr++;
  23.     }
  24.     sptr++;
  25.     }
  26.     *sptr = 0;            /* SAVE[] ends in 00 terminator */
  27.  
  28.     sptr = save;
  29.     if (*sptr == 0) {        /* Change IBM System call to ROM call */
  30.     sptr++;
  31.     *sptr |= 0x80;        /* Set high bit on next char */
  32.     }
  33.  
  34.     if ( getmess(messbuf,sptr,topname) )
  35.     output("<%s>",messbuf);         /* display string and key codes */
  36.  
  37.     else {
  38.  
  39.     for (sptr=save; *sptr; sptr++) {
  40.         c = *sptr;
  41.         if (c & 0x80) {
  42.         output("%s", func);
  43.         c &= 0x7f;
  44.         }
  45.         mnemonic(c);    /* Convert char to mnemonic if possible */
  46.         outc(SPACE);
  47.     }
  48.     }
  49. }
  50.  
  51.